package com.doubi.modelvo.sys;

import com.doubi.utils.DataUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;

/**
 * 后台用户表
 *
 * @author MrDoubi123
 * @since 2019-10-20
 */
@Data
@ApiModel("用户实体对象")
public class TSysUserVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(example = "唯一标识")
    private String oid;
    @ApiModelProperty(example = "用户类型 ‘user’ 普通用户")
    private String userType;
    @ApiModelProperty(example = "账户")
    private String account;

    @ApiModelProperty(example = "昵称")
    private String name;
    @ApiModelProperty(example = "头像")
    private String head;
    @ApiModelProperty(example = "1男 2女")
    private Integer sex;
    private String phone;
    private String email;
    private String province;
    private String city;
    private String area;
    @ApiModelProperty(example = "token")
    private String token;
    @ApiModelProperty(example = "生日")
    private Date birthday;

    public String getAccount(){
        if(DataUtil.isEmpty(account)){
            return this.account;
        }else if(account.length() >= 11){
            return account.replaceAll("(\\d{4})\\d{10}(\\w{4})","$1*****$2");
        }else {
            return this.account;
        }
    }
    @ApiModelProperty(example = "微信唯一标识")
    private String weixinid;
    @ApiModelProperty(example = "qq唯一标识")
    private String qqid;
    @ApiModelProperty(example = "微博唯一标识")
    private String weiboid;
}